/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rmi;

import java.math.BigDecimal;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Hippolyte
 */
public class Serveur {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        String interroger = callback.client.CallbackClient.interroger();


        System.out.println("demande du client : " + interroger);

        String[] split = interroger.split(";");

        int debut = Integer.parseInt(split[0]);
        int fin = Integer.parseInt(split[1]);
        int nbDecimal = Integer.parseInt(split[2]);

        CalculDePi cdpi = new CalculDePi(debut, fin, nbDecimal);

        BigDecimal pi = cdpi.calcul();

        System.out.println("pi en local sur serveur " + pi);
        
        try {

            callback.client.CallbackClient.proxy.setPi(pi);

        } catch (RemoteException ex) {
            Logger.getLogger(Serveur.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
